<template>
  <view class="content">
    <image class="logo" src="@/static/logo.png"></image>
    <view class="text-area">
      <zy-update theme="blue" :updateurl="updateurl" :noticeflag="true" :h5preview="false"
                 ref="zyupgrade" :showupdateTips="showupdatetips"></zy-update>
      <text class="title">MES辅助app</text>
    </view>
  </view>
</template>

<script>
  import ZyUpdate from "../components/zy-upgrade/zy-upgrade.vue";
  import {baseUrl} from "../config";

  export default {
    data() {
      return {
        updateurl: baseUrl + '/mesLogin/checkNewApp',
        windowHeight: uni.getSystemInfoSync().windowHeight,
        updateFlag: true,
      }
    },
    components: {ZyUpdate},
    onLoad: function() {
      setTimeout(()=> {
        this.handleToUpgrade();
      }, 500);
    },
    methods: {
      showupdatetips:function(flag) {
        if(flag === 0){
          uni.showToast({
            title: '已经是最新版本了',
            icon:'none'
          });
        }
      },
      handleToUpgrade() {
        if (uni.getStorageSync('cacneUpdateFlag') === true) {
          uni.setStorageSync('cacneUpdateFlag', false);
          return;
        }
        this.$refs.zyupgrade.check_update();
      },
    }
  }
</script>

<style>
  .content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .logo {
    height: 200rpx;
    width: 200rpx;
    margin-top: 200rpx;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 50rpx;
  }

  .text-area {
    display: flex;
    justify-content: center;
  }

  .title {
    font-size: 36rpx;
    color: #8f8f94;
  }
</style>
